<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>二次开发--模块管理--模块方法表</title>
    <% layout("/inc/easyui.html"){} %>

</head>
<body>
<form style="margin: 0px;padding: 0px;" method="post" id="addForm">
    <input type="hidden" name="methodId" id="methodId"/>
    <input type="hidden" name="objId" value="${objId}"/>
    <input type="hidden" name="iconPath" id="iconPath" value="/res/jquery-easyui-1.5.3/themes/icons/pencil.png"/>
    <input type="hidden" name="icon" id="icon" value="icon-remove"/>

    <div id="p" class="easyui-panel" title="基础配置" style="width:100%;" data-options="collapsible:true ">
        <table width="100%" class="sztable" align="center">
            <tr>
                <td class="sztabletext" width="20%">方法编码:</td>
                <td width="30%">
                    <input name="code" type="text" style="width:200px;" prompt="请填写方法编码" id="code"
                           class="easyui-textbox" maxLength="20"
                           data-options="required:true"/>
                </td>
                <td class="sztabletext" width="20%">方法名称:</td>
                <td width="30%">
                    <input name="name" type="text" style="width:200px;" prompt="请填写方法名称"
                           class="easyui-textbox" maxLength="20"
                           data-options="required:true"/>
                </td>
            </tr>
            <tr>
                <td class="sztabletext" width="20%">按钮图标:</td>
                <td width="30%">
                    &nbsp;<img src="${ctxPath}/res/jquery-easyui-1.5.3/themes/icons/pencil.png" width="16px;" height="16px;" id="imgsrc" >&nbsp;
                    <a href="#" class="easyui-linkbutton" onclick="javascript:chooseIcon()">选择</a>
                </td>
                <td class="sztabletext" width="20%">图标位置:</td>
                <td width="30%">
                    <#dictTag name="iconPosition" showType="radio" dictCode="iconPosition" width="200" value="1" ></#dictTag>
                </td>
            </tr>
            <tr>
                <td class="sztabletext" width="20%">方法类型:</td>
                <td width="30%">
                    <#dictTag name="methodType" showType="select" showNull="false" dictCode="methodType" width="200" value="edit" ></#dictTag>
                </td>
                <td class="sztabletext" width="20%">展示类型:</td>
                <td width="30%">
                    <#dictTag name="showType" showType="select" showNull="false" dictCode="showType" width="200" value="dialog"  dataOptions="onChange:doShow"></#dictTag>
                </td>
            </tr>
            <tr>
                <td class="sztabletext" width="20%">是否可用</td>
                <td width="30%">
                    <#dictTag name="status" showType="radio" dictCode="status" width="200" value="1" ></#dictTag>
                </td>
                <td class="sztabletext" width="20%">默认方法:</td>
                <td width="30%">
                    <#dictTag name="defaultMethod" showType="radio" dictCode="yesornot" width="200" value="0" ></#dictTag>
                </td>
            </tr>
            <tr>
                <td class="sztabletext" width="20%">是否自适应:</td>
                <td width="30%">
                    <#dictTag name="fitCloumn" showType="radio" dictCode="yesornot" width="200" value="1" ></#dictTag>
                </td>
                <td class="sztabletext" width="20%">排序:</td>
                <td width="30%">
                    <input name="seq" type="text" style="width:200px;"
                           class="easyui-numberbox" maxLength="3"  value="99"
                           data-options="required:true"/>
                </td>
            </tr>
        </table>
    </div>
    <div id="p2" class="easyui-panel" title="扩展设置" style="width:100%;" data-options="collapsible:true ">
        <table width="100%" class="sztable" align="center">
        <tr class="queryTr" >
            <td class="sztabletext" width="20%">视图SQL:</td>
            <td colspan="3">
                <input id="viewSql" name="viewSql" type="text"  style="width:690px;height:100px" multiline="true"
                       prompt="请填写视图SQL"
                       class="easyui-textbox" maxLength="400"  validType="length[0,400]"/>
            </td>
        </tr>
        <tr class="queryTr" >
            <td class="sztabletext" width="20%">是否单选:</td>
            <td width="30%">
                <#dictTag name="singleAble" showType="radio" dictCode="yesornot" showNull="false" width="200" value="0" ></#dictTag>
            </td>
            <td class="sztabletext" width="20%">是否初始加载:</td>
            <td width="30%">
                <#dictTag name="firstLoad" showType="radio" dictCode="yesornot" showNull="false" width="200" value="0"  ></#dictTag>
            </td>
        </tr>
        <tr class="queryTr" >
            <td class="sztabletext" width="20%">默认排序字段:</td>
            <td width="30%">
                <input name="defaultOrder" type="text"  style="width:200px;"
                       class="easyui-textbox"  maxLength="20" />
            </td>
            <td class="sztabletext" width="20%">排序方式:</td>
            <td width="30%">
                <#dictTag name="orderType" showType="radio" dictCode="orderType" width="200"  value="asc" ></#dictTag>
            </td>
        </tr>
        <tr class="dialogTr">
            <td class="sztabletext" width="20%">显示宽度:</td>
            <td width="30%">
                <input name="width" type="text" style="width:200px;"  data-options="min:100" value="800"
                       class="easyui-numberbox" maxLength="4"
                       data-options="required:true"/>
            </td>
            <td class="sztabletext" width="20%">显示高度:</td>
            <td width="30%">
                <input name="height" type="text" style="width:200px;" data-options="min:100" value="600"
                       class="easyui-numberbox" maxLength="4"
                       data-options="required:true"/>
            </td>
        </tr>
        <tr class="dialogTr">
            <td class="sztabletext" width="20%">提示内容:</td>
            <td colspan="3">
                <input name="msg" type="text" style="width:690px" class="easyui-textbox" maxLength="120"  prompt="请填写提示内容" data-options="required:true" value="修改成功"/>
            </td>
        </tr>
    </table>
    </div>
    <div id="p3" class="easyui-panel" title="高级设置" style="width:100%;" data-options="collapsible:true ">
        <table width="100%" class="sztable" align="center">
            <tr>
                <td class="sztabletext" width="20%">依赖JS:</td>
                <td colspan="3">
                    <input name="diyJs" type="text"  style="width:690px;" class="easyui-textbox"  maxLength="120"  prompt="请填写js路径"  />
                </td>
            </tr>
            <tr>
                <td class="sztabletext" width="20%">初始字典:</td>
                <td colspan="3">
                    <input name="initDict" type="text"  style="width:690px;" class="easyui-textbox"  maxLength="120"  prompt="请填写字典code值，多个用逗号分隔" />
                </td>
            </tr>
            <tr>
                <td class="sztabletext" width="20%">页面路径:</td>
                <td colspan="3">
                    <input name="pagePath" type="text" style="width:690px;" class="easyui-textbox" maxLength="120"  prompt="请填写页面路径" />
                </td>
            </tr>
            <tr>
                <td class="sztabletext" width="20%">描述:</td>
                <td colspan="3">
                    <input name="note" type="text"  style="width:690px;"  prompt="请填写描述"
                           class="easyui-textbox" maxLength="200" />
                </td>
            </tr>
            <tr style="background: #f1f1f1;">
                <td align="center" colspan="4">
                    <a href="javascript:{doSave()}" class="easyui-linkbutton" iconCls="icon-save"   >保存</a>
                    <a href="javascript:{doClear()}" class="easyui-linkbutton" iconCls="icon-redo"  >重置</a>
                </td>
            </tr>
        </table>
    </div>
</form>
    <script type="text/javascript" >

        $(function () {
            doShow();
        });

        /**
         * 隐藏、显示控件
         */
        function doShow() {
            //方法类型，显示类型
            var showType = $("#showType").combobox("getValue") || "dataGrid";
            if(showType == "dataGrid"){
                $(".dialogTr").css("display" , "none");
                $(".queryTr").css("display" , "");
            }else {
                $(".dialogTr").css("display" , "");
                $(".queryTr").css("display" , "none");
            }
        }

        /**
         * 选择图标
         */
        var chooseIcon = function () {
            xlauch.selIcon({
                selfun : function (iconUrl, iconCss) {
                    $('#icon').val(iconCss);
                    $('#iconPath').val(iconUrl);
                    $("#imgsrc").attr("src","${ctxPath}" + iconUrl);
                }
            }, "${ctxPath}")
        }

        /**
         * 保存方法
         */
        function doSave() {
            var f = $("#addForm");
            if (f.form('validate')) {
                var options = {
                    type : "post",
                    url: "${ctxPath}/deve/deveObjectMethod/add",
                    cache : "false",
                    contentType: "application/x-www-form-urlencoded;charset=utf-8",
                    beforeSend : function () {
                        parent.$.messager.progress({
                            text : '正在处理中...'
                        });
                    },
                    success : function(json){
                        parent.$.messager.progress('close');
                        var _msg = json._msg ;
                        if (json._code == xlauch.RES_SUCC) {
                            $("#methodId").val(json._msg);
                            $("#methodId",window.parent.document).val(json._msg);
                            
                            _msg =  "保存成功" ;
                        }
                        parent.xlauch.messagerShow({
                            msg : _msg,
                            title : '提示'
                        });
                    },
                    error : function(json){
                        json = json.responseJSON ;
                        var _msg = json["_msg"] + "错误代码:" + json._code ;
                        parent.$.messager.alert("提示", "保存失败，" + _msg);
                        parent.$.messager.progress('close');
                    }
                };
                // 异步提交
                f.ajaxSubmit(options);
            }
        }


    </script>

</body>
</html>